<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class base_model extends CI_Model {

    protected $tbl_name;

    public function __construct($tbl_name=null) {
        parent::__construct();
        $this->tbl_name = $tbl_name;
    }

    function insert($data) {
        $this->db->insert($this->tbl_name, $data);
    }

    function update($id, $val, $data) {
        $this->db->where($id, $val);
        $this->db->update($this->tbl_name, $data);
    }

    function delete($id, $val) {
        $this->db->where($id, $val);
        $this->db->delete($this->tbl_name);
    }

    function get_by_id($id, $val) {
        $this->db->where($id, $val);
        return $this->db->get($this->tbl_name);
    }

    function get_all() {
        return $this->db->get($this->tbl_name);
    }

}

/* End of file base_model.php */
/* Location: ./application/controllers/base_model.php */